package com.gjx.springboot.api.controller;

import com.gjx.springboot.domain.entity.Jobs;
import com.gjx.springboot.app.service.JobsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class JobsController {
    @Autowired
    JobsService jobsService;

    @RequestMapping("/getalljobs")
    @ResponseBody
    public List<Jobs> getAllJobs() {
        List<Jobs> allJobs = jobsService.getAllJobs();
        return allJobs;
    }

    @RequestMapping("/insertonejobs")
    @ResponseBody
    public Boolean inserOneJob(@RequestBody Jobs jobs) {
        Boolean aBoolean = jobsService.insertOneJob(jobs);
        return aBoolean;
    }

    @RequestMapping("/deleteonejob")
    @ResponseBody
    public Boolean deleteOneJob(String jobId) {
        Boolean aBoolean = jobsService.deleteOneJob(jobId);
        return aBoolean;
    }
    @RequestMapping("/updateonejob")
    @ResponseBody
    public Boolean updateOneJob(@RequestBody Jobs jobs){
        Boolean aBoolean = jobsService.updateOneJob(jobs);
        return aBoolean;
    }
}
